package MyFront.Controller;

import MyFramePro.Annotation.SystemLog;
import MyFramePro.Domain.Entity.User;
import MyFramePro.Domain.ResponseResult;
import MyFramePro.Service.Impl.UserServiceImpl;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping(value = "/user")
public class UserController {

    @Resource
    private UserServiceImpl userService;

    /**
     * 这里是个人信息查询功能
     */
    @GetMapping(value = "/userInfo")
    @SystemLog(businessName = "查询当前用户的个人信息")    //这里使用 AOP 切面
    public ResponseResult getUserInfo(){

        return userService.userInfo();
    }


    /**
     * 这里个人信息更新的功能
     */
    @PutMapping(value = "/userInfo")
    @SystemLog(businessName = "个人信息更新功能")
    public ResponseResult updateUserInfo(@RequestBody User user){

        return userService.updateInfo(user);
    }


    /**
     * 这里是用户注册的功能
     */
    @PostMapping(value = "/register")
    @SystemLog(businessName = "用户注册功能")
    public ResponseResult userRegister(@RequestBody User user){

        return userService.userRegister(user);
    }


}
